package com.zx.disneyholidays.utils;

import android.content.Context;

public class BaseUtil {
    public static int dp2px(Context context, float dipValue) {
        if (context == null)
            return (int) (dipValue * 1.5);
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dipValue * scale + 0.5f);
    }


    /**
     * get the width of the device screen
     *
     * @param context
     * @return
     */
    public static int getScreenWidth(Context context) {
        if (context == null)
            return 1;
        return context.getResources().getDisplayMetrics().widthPixels;
    }
}
